﻿<%@ WebHandler Language="C#" Class="getMessageCount" %>

using System;
using System.Web;
using System.Web.SessionState;

public class getMessageCount : IHttpHandler,IRequiresSessionState {
    
    public void ProcessRequest (HttpContext context) {
        BLL.Message bllmessage = new BLL.Message();
        if (common.isLoginOrNot())
        {
            if (context.Session["currentUser"] != null)
            {
                int uid = ((MODEL.Users)context.Session["currentUser"]).UId;
                if (bllmessage.getMCByuid(uid) > 0)
                {
                    int pageNum;
                    pageNum = bllmessage.getMCByuid(uid);
                    context.Response.Write(pageNum);
                }
                else
                {
                    context.Response.Write("no");
                }
            }
            else
            {
                context.Response.Write("no");
            }
        }
        else
        {
            context.Response.Write("no");
        }
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}